{*
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 *}
{if $access.make_sticky or $access.close_topic or ($access.post_reply and !$agora_user.is_guest)}
 <script type="text/javascript">
<!--
var agora_merge_url = '{url task=topic action=merge source_id=$topic_id type=clean}';
{literal}
function agora_merge() {
	
	new Ajax(agora_merge_url, {
			method: 'post',
			onFailure: function(){},
			onComplete: function(inResponse) {
				var box = SqueezeBox.initialize();
				box.assignOptions();
				box.setContent('string',inResponse);
			}
	}).request();
}
{/literal}

{literal}
function agora_merge_step2() {

	new Ajax(agora_merge_url, {
			method: 'post',
			postBody: Object.toQueryString({id: $('forum_select_id').getValue()}),
			onFailure: function(){},
			onComplete: function(inResponse) {
				var box = SqueezeBox.initialize();
				box.assignOptions();
				box.setContent('string',inResponse);
			}
	}).request();
}
{/literal}

var agora_move_url = '{url task=topic action=move source_id=$topic_id type=clean}';
{literal}
function agora_move() {
	
	new Ajax(agora_move_url, {
			method: 'post',
			onFailure: function(){},
			onComplete: function(inResponse) {
				var box = SqueezeBox.initialize();
				box.assignOptions();
				box.setContent('string',inResponse);
			}
	}).request();
}
{/literal}


//-->
</script>
<ul id="ag_f_menu">
	<li class="ag_node">
		<a href="javascript:void(0);" class="ag_f_menu_title">##Post Tools##</a>
		<ul>
			{if $access.make_sticky}
			<li class="ag_li">
				{if $topic.sticky}
				<a href="{url task=topic action=unsticky id=$topic.id}" class="icon_unsticky">##UnSticky Topic##</a>
				{else}
				<a href="{url task=topic action=sticky id=$topic.id}" class="icon_sticky">##Sticky Topic##</a>
				{/if}
			</li>
			{/if}
			{if $access.close_topic}
			<li class="ag_li">
				{if $topic.closed}
				<a href="{url task=topic action=open id=$topic.id}" class="icon_open">##Open Topic##</a>
				{else}
				<a href="{url task=topic action=close id=$topic.id}" class="icon_close">##Close Topic##</a>
				{/if}
			</li>
			<li class="ag_li">
				<a href="#" class="icon_merge" onclick="agora_merge();return false;">##Merge Topic##</a>
			</li>
			<li class="ag_li">
				<a href="#" class="icon_move" onclick="agora_move();return false;">##Move Topic##</a>
			</li>
			{/if}

			{*
			 * We have to check guest status here, because guests can't vote (to prevent spam)
			 * If we show this link and a guest clicks it they get "Bad Request"
			 *}
			{if $access.post_reply and !$agora_user.is_guest}
			<li class="ag_li">
				<a href="{url task=rate id=$topic.id}" class="icon_rate">##Rate topic##</a>
			</li>
			{/if}
			<li class="ag_li">
				{if !$topic.subscribed}
				<a href="{url task=topic action=subscribe id=$topic.id}" class="icon_subscribe">##Subscribe##</a> 
				{else}
				<a href="{url task=topic action=unsubscribe id=$topic.id}" class="icon_unsubscribe">##Unsubscribe##</a>
				{/if}
			</li>
			
			{* //Joopport added Добавляем панель инструментов по управлению статусом топика для модератора *}
				{if $forum.forum_type and $access.close_topic}
					{include file=agora:tools/joop_topic.tpl}
				{/if}
			{* end of joopport *}
		</ul>
	</li>
</ul>
{/if}